
#include "esp_netif.h"
#include "esp_event.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"
#include "nvs.h"

extern void wifi_connect(void);
extern void tcp_server_wait_connect(void*e);
extern void canInit();

extern void tcp_to_can();
extern void can_to_tcp();


void can_tcp_adapter_main(void)
{
    canInit();

    wifi_connect();
    vTaskDelay(pdMS_TO_TICKS(5000));    //等连接上wifi

    xTaskCreatePinnedToCore(tcp_server_wait_connect,"tcp_server_wait_connect",2048,NULL,3,NULL, tskNO_AFFINITY);
    vTaskDelay(pdMS_TO_TICKS(5000));    //等连

    xTaskCreatePinnedToCore(tcp_to_can,"tcp_to_can",2048,NULL,3,NULL, tskNO_AFFINITY);
    xTaskCreatePinnedToCore(can_to_tcp,"can_to_tcp",2048,NULL,3,NULL, tskNO_AFFINITY);
}

